package com.tigase.client.demo;
//package com.tigase.client.demo;
//
//import java.io.IOException;
//
//import tigase.jaxmpp.core.client.exceptions.JaxmppException;
//import tigase.jaxmpp.j2se.ConnectionConfiguration;
//import tigase.jaxmpp.j2se.ConnectionConfiguration.ConnectionType;
//import tigase.jaxmpp.j2se.Jaxmpp;
//
///**
// * tigase client
// * 
// */
//public class TigaseClient {
//	
//	private Jaxmpp jaxmpp;
//	
//	
//	public void testLogin(String[] args) throws InterruptedException {
//
//		// 本地环境，连接本地库
//		String from = "zhangsan", password="123456", to = "lisi", serviceName = "dev1";
//		Jaxmpp jaxmpp = new Jaxmpp();
//		
//		ConnectionConfiguration connectionConfiguration = jaxmpp.getConnectionConfiguration();
//		connectionConfiguration.setConnectionType(ConnectionType.socket);
//		connectionConfiguration.setUserJID(from+"@" + serviceName);
//		connectionConfiguration.setUserPassword(password);
//		connectionConfiguration.setServer(serviceName);
//		// connectionConfiguration.setBoshService(serviceName);
//		connectionConfiguration.setPort(5222);
//		
//		try {
//			jaxmpp.login(true);
//			
//			// 检测好友上线
////			jaxmpp.addListener(Jaxmpp.Connected, new Listener<JaxmppEvent>() {
////				@Override
////				public void handleEvent(JaxmppEvent be) throws JaxmppException {
////					System.out.println("---" + be.getSessionObject().getUserBareJid().getLocalpart() +"登录成功---");
////				}
////			});
////			
////			jaxmpp.addListener(Jaxmpp.Disconnected,  new Listener<JaxmppEvent>() {
////				@Override
////				public void handleEvent(JaxmppEvent be) throws JaxmppException {
////					System.out.println("---" + be.getSessionObject().getUserBareJid().getLocalpart() +"退出---");
////				}
////			});
////			
////			jaxmpp.sendMessage(toJID, subject, message);
//			
//			System.in.read();
//		} catch (JaxmppException e) {
//			e.printStackTrace();
//		} catch (IOException e) {
//			e.printStackTrace();
//		} finally {
//			if(null != jaxmpp) {
//				try {
//					jaxmpp.disconnect();
//				} catch (JaxmppException e) {
//					e.printStackTrace();
//				}
//			}
//		}
//		
//		System.out.println("end!");
//	}
//}
